package com.example.consumer;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.example.comm.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableDubbo
@EnableDiscoveryClient
@SpringBootApplication
public class SpringCloudDubboConsumerlication {

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudDubboConsumerlication.class, args);
    }


    @RestController
    public class Controller {
        @DubboReference(version = "1.0")
        private UserService userService;

        @GetMapping("getByName")
        public String getByName() {
            return userService.getByName();
        }
    }
}
